:- use_module(library('clp/bounds')).

% hospital capacity(hospital nuber, capacity)
hc(1,1).
hc(2,2).

% arrival time /to disaster/ (N brigade, time) 
at(1,5).
at(2,15).

% time to hospital (N brigade, N hospital, time)
ht(1,1,10).
ht(1,2,100).
ht(2,1,10).
ht(2,2,100).

% path(N brigade, N from, N to, path time)
% path(1,0,1,T) = 15 = 5 + 10.
% path(2,0,1,T) = 25 ???  = 15 + 100.
% path(2,1,2,T) = 110 = 10 + 100.
%
%
path(Br,0,B,T) :- 
        at(Br,AT), 
        ht(Br,B,HT), 
        T #= AT + HT.
%       write(0 -> B : T),nl.

path(Br,A,B,T) :- 
        ht(Br,A,HT1), 
        ht(Br,B,HT2), 
        T #= HT1 + HT2.
%       write(A -> B : T), nl


% run_tests.
% show_coverage(run_tests).
:- begin_tests(path_example).
:- use_module(library(lists)).

test(path) :-
        path(1,0,1,T),
        T is 5 + 10.

test(path) :-
        path(2,0,1,T),
        T is 15 + 10.

test(path) :-
        path(2,1,2,T),
        T is 10 + 100.



:- end_tests(path_example).
